package top.broncho.lottery.data.paging

import androidx.lifecycle.LiveData
import androidx.paging.PagedList

/**
 * Data class that is necessary for a UI to show a listing and interact w/ the rest of the system
 * 封装需要监听的对象和执行的操作，用于上拉下拉操作
 * pagedList ： 数据列表
 * loadingState ： 加载状态
 * refresh ： 刷新操作
 * retry ： 重试操作
 */
data class Listing<T>(
    // the LiveData of paged lists for the UI to observe
    val pagedList: LiveData<PagedList<T>>,
    // represents the network request status to show to the user
    val loadingState: LiveData<LoadingState>,
    // refreshes the whole data and fetches it from scratch.
    val refresh: () -> Unit,
    // retries any failed requests.
    val retry: () -> Unit
)